//
//  BaseTabBarController.m
//  LingQianZhu
//
//  Created by 谢英泽 on 2016/12/9.
//  Copyright © 2016年 谢英泽. All rights reserved.
//

#import "BaseTabBarController.h"
#import "HomeController.h"
#import "InvestController.h"
#import "MeController.h"
#import "AppHeader.h"

@interface BaseTabBarController ()

@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) NSArray *normalImages;
@property (nonatomic, strong) NSArray *selectedImages;

@end

@implementation BaseTabBarController

#pragma mark - *********************生命周期*********************

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self tabBarConfiguration];
    
    [self setupTabBarControllers];
}

#pragma mark - *********************基础配置*********************
/**
 tabbar的基本配置
 */
- (void)tabBarConfiguration {
    self.tabBar.tintColor = kCOLOR_tabBar;
}
/**
 设置控制器
 */
- (void)setupTabBarControllers {
    self.titles         = @[@"首页",@"投资",@"我"];
    self.normalImages   = @[@"tabbar_wallet",@"tabbar_Invest",@"tabbar_me"];
    self.selectedImages = @[@"tabbar_wallet_selected",@"tabbar_Invest_selected",@"tabbar_me_selected"];

    //首页
    HomeController *homeCtrl = [HomeController new];
    UINavigationController *homeNav = [[UINavigationController alloc] initWithRootViewController:homeCtrl];
    homeNav.title = self.titles[0];
    homeNav.tabBarItem.image = [[UIImage imageNamed:self.normalImages[0]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    homeNav.tabBarItem.selectedImage = [[UIImage imageNamed:self.selectedImages[0]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    //投资
    InvestController *investCtrl = [InvestController new];
    UINavigationController *investNav = [[UINavigationController alloc] initWithRootViewController:investCtrl];
    investNav.title = self.titles[1];
    investNav.tabBarItem.image = [[UIImage imageNamed:self.normalImages[1]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    investNav.tabBarItem.selectedImage = [[UIImage imageNamed:self.selectedImages[1]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    //我
    MeController *meCtrl = [MeController new];
    UINavigationController *meNav = [[UINavigationController alloc] initWithRootViewController:meCtrl];
    meNav.title = self.titles[2];
    meNav.tabBarItem.image = [[UIImage imageNamed:self.normalImages[2]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    meNav.tabBarItem.selectedImage = [[UIImage imageNamed:self.selectedImages[2]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    self.viewControllers = @[homeNav, investNav, meNav];

}

@end
